package com.time.hellotime.db;

import android.database.sqlite.SQLiteDatabase;

import org.litepal.tablemanager.Connector;

/**
 * 数据库管理类
 * Created by Bing on 2016/8/23.
 * E-mail is tx16bing@163.com
 */
public class DBUtil {

    private volatile static DBUtil instance;
    private SQLiteDatabase db;

    private DBUtil(){
        // 生成数据库
        db = Connector.getDatabase();
    }

    public static DBUtil getInstance(){
        if (instance == null){
            synchronized (DBUtil.class){
                if (instance == null){
                    instance = new DBUtil();
                }
            }
        }
        return instance;
    }

    public void closeDB(){
        if (db != null){
            db.close();
        }
    }

}
